<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>17_baiduMap</title>
	<base target="blank">
	<style>
		#konwledege{
			position: fixed;
			right: 2%;
			top:2%;
			text-decoration:underline;
			color:inherit;
			outline: none;
			color: orange;
			font-size: 12px;
		}
		#toTop{
			position: fixed;
			right: 2%;
			bottom: 2%;
			box-shadow: 1px 1px 1px rgba(0,0,0,.5);
			border-radius: 100%;
			width: 40px;
			height: 40px;
			line-height: 40px;
			font-size: 12px;
			text-align: center;
			color: red;
			z-index: 9999;
		}
		*{margin:0;padding: 0;}
		body{
			font-family: 'Microsoft yahei', Verdana, '仿宋',Arial, Helvetica, sans-serif;
			font-size: 18px;
			max-width: 1000px;
			margin: auto;
			position: relative;
		}
		a{text-decoration:none;color:inherit;outline: none;}
		img{border:none;vertical-align: middle;outline:none;}
		li{list-style:none;}
		
		section{
			position: relative;
			margin:50px auto;
		}
		section>h2{
			margin-bottom: 25px;
			text-align: center;
		}
		/*------------------------------jd-----------------------------------*/
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=TFUzKanYlqx7eCkE7SceTqgRuVOkNhHR"></script>
</head>
<body>
	<div id="konwledege"><a href="baseKnowledege.html" target="_self">基本知识</a></div>
	<a href="#" id='toTop'>Top</a>
	<section>
		<div id="allmap"></div>
	</section>
	<script>
		(function () {
			var x,y;
			navigator.geolocation.getCurrentPosition(function (position) {
				x = position.coords.latitude;//经度
				y = position.coords.longitude;//维度
				var geoc = new BMap.Geocoder();    
				var pt = new BMap.Point(y,x);
				geoc.getLocation(pt, function(rs){
					var addComp = rs.addressComponents;
					alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
				});
				var map = new BMap.Map("allmap");
				map.centerAndZoom(pt,12);     
			});

		})();
	</script>
</body>
</html>